<!--
 * @Author: EternityJun 2438965023@qq.com
 * @Date: 2025-05-10 09:32:31
 * @LastEditors: EternityJun 2438965023@qq.com
 * @LastEditTime: 2025-05-19 18:08:07
 * @FilePath: \private-domain-small-program\src\components\popUp\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <uv-popup ref="popupRef" :mode="mode" radius="20rpx" :duration="duration" :z-index="zIndex"
    :safe-area-inset-bottom="safeAreaInsetBottom" @close="handleClose">
    <view class="custom-modal" :style="{ width: modalWidth + 'rpx' }">
      <slot></slot>
    </view>
  </uv-popup>
</template>

<script setup>
import { emit } from 'process';
import { ref } from 'vue';

const props = defineProps({
  duration: {
    type: Number,
    default: 100
  },
  mode: {
    type: String,
    default: 'center'
  },
  zIndex: {
    type: Number,
    default: 100
  },
  safeAreaInsetBottom: {
    type: Boolean,
    default: true
  },
  modalWidth: {
    type: String,
    default: '624'
  },
})
const popupRef = ref();
// 方法
const open = () => popupRef.value?.open();
const close = () => popupRef.value?.close();

const handleClose = () => {
  emit('close')
}
defineExpose({ open, close })
</script>

<style lang="scss" scoped>
.custom-modal {
  width: 624rpx;
  height: 630rpx;
  background: #FFFFFF;
  border-radius: 40rpx;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;

  .image {
    width: 32rpx;
    height: 32rpx;
    position: absolute;
    right: 18rpx !important;
    top: 18rpx !important;
  }
}
</style>